package top.suven.base.http.admin.user.dao;

import org.apache.ibatis.annotations.*;
import top.suven.base.core.mybatis.crud.CommonCrudMapper;
import top.suven.base.http.admin.user.model.UserData;

import java.util.List;

/**
 * @Title: UserDataWebDao.java
 * @Description: 用户扩展信息的数据交互类
 * @author lixiangling
 * @date   2018/08/14 16:52:42
 * @version V1.0.0
 * ----------------------------------------------------------------------------
 *  modifyer    modifyTime                 comment
 *
 * ----------------------------------------------------------------------------
 *
 */
public interface UserDataWebDao extends CommonCrudMapper<UserData> {
    @Select("<script> " +
    "select * from  rf_user_data where status='1' and enable_status='1' and user_id in " +
    "<foreach item='item' index='index' collection='idList' open='(' separator=',' close=')'> " +
    "#{item} " +
    "</foreach> " +
    "</script>")
    @Results(
        id="userData",
        value = {
            @Result(column = "user_id" , property = "userId"),
			@Result(column = "nationality_id" , property = "nationalityId"),
			@Result(column = "province_id" , property = "provinceId"),
			@Result(column = "city_id" , property = "cityId"),
			@Result(column = "enable_status" , property = "enableStatus"),
			@Result(column = "status" , property = "status"),
			@Result(column = "creater" , property = "creater"),
			@Result(column = "create_time" , property = "createTime"),
			@Result(column = "modifier" , property = "modifier"),
			@Result(column = "modify_time" , property = "modifyTime"),
			@Result(column = "reorder" , property = "reorder"),
			@Result(column = "remark" , property = "remark"),
			@Result(column = "channel_id" , property = "channelId"),
			@Result(column = "channel_id_old" , property = "channelIdOld"),
			@Result(column = "baidu_user_id" , property = "baiduUserId"),
			@Result(column = "baidu_user_id_old" , property = "baiduUserIdOld"),
			@Result(column = "user_email" , property = "userEmail"),
			@Result(column = "mac_id" , property = "macId"),
			@Result(column = "imei" , property = "imei"),
			@Result(column = "device_token" , property = "deviceToken"),
			@Result(column = "image_url" , property = "imageUrl"),
			@Result(column = "nick_name" , property = "nickName"),
			@Result(column = "lottery_count" , property = "lotteryCount"),
			@Result(column = "bank_username" , property = "bankUsername"),
			@Result(column = "bank_card" , property = "bankCard"),
			@Result(column = "bank_name" , property = "bankName"),
			@Result(column = "contact_phone" , property = "contactPhone"),
			@Result(column = "secure_pwd" , property = "securePwd"),
			@Result(column = "invit_award_lottery" , property = "invitAwardLottery"),
			@Result(column = "system_lottery_count" , property = "systemLotteryCount"),
			@Result(column = "is_click_home" , property = "isClickHome"),
			@Result(column = "sex" , property = "sex"),
			@Result(column = "birthday" , property = "birthday"),
			@Result(column = "user_location" , property = "userLocation"),
			@Result(column = "user_occupation" , property = "userOccupation"),
			@Result(column = "qualifications" , property = "qualifications"),
			@Result(column = "county_id" , property = "countyId"),
			@Result(column = "secure_fault_count" , property = "secureFaultCount"),
			@Result(column = "pad_unique" , property = "padUnique"),
			@Result(column = "invite_code" , property = "inviteCode"),
			@Result(column = "login_days" , property = "loginDays"),
			@Result(column = "cuid" , property = "cuid"),
			@Result(column = "secure_fault_count2" , property = "secureFaultCount2"),
			@Result(column = "secure_fault_count3" , property = "secureFaultCount3")
        }
    )
    List<UserData> getSysRoleMenuByRoleCodeList(@Param("idList") List<Long> idList);
    /**
     * @Title: 删除用户扩展信息信息
     * @Description:id @{Link Long[]}
     * @param
     * @return
     * @throw
     * @author lixiangling
     * @date 2018/08/14 16:52:42
     *  --------------------------------------------------------
     *  modifyer    modifyTime                 comment
     *
     *  --------------------------------------------------------
     */
    @Update("<script> " +
            "UPDATE rf_user_data set status='0'"+
            "WHERE user_id IN " +
            "<foreach item='item' index='index' collection='idList' open='(' separator=',' close=')'> " +
            "#{item} " +
            "</foreach> " +
            "</script>")
    void del(@Param("idList") List<Long> idList);
    /**
     * @Title: 禁用用户扩展信息信息
     * @Description:id @{Link Long}
     * @param
     * @return
     * @throw
     * @author lixiangling
     * @date 2018/08/14 16:52:42
     *  --------------------------------------------------------
     *  modifyer    modifyTime                 comment
     *
     *  --------------------------------------------------------
     */
     @Update("<script> " +
             "UPDATE rf_user_data  " +
             "SET user_id = #{enableStatus}  " +
             "WHERE user_id IN " +
             "<foreach item='item' index='index' collection='idList' open='(' separator=',' close=')'> " +
             "#{item} " +
             "</foreach> " +
             "</script>")
     void updateEnableStatus(@Param("enableStatus") String enableStatus, @Param("idList") List<Long> idList);
}